﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using System.ComponentModel.DataAnnotations;
using System.Data.Objects.DataClasses;

namespace SportStore.Models.Entities
{
    public class Category
    {
        private EntityCollection<Product> _products;

        [HiddenInput(DisplayValue=false)]
        public int CategoryID { get; set; }

        [Required(ErrorMessage="Please enter a category name")]
        public string Name { get; set; }

        [Required(ErrorMessage = "Please enter a description")]
        [DataType(DataType.MultilineText)]
        public string Description { get; set; }

        public EntityCollection<Product> Products
        {
            get
            {
                return _products ?? (_products = new EntityCollection<Product>());
            }
            set 
            {
                _products = value;
            }
        }

        [HiddenInput(DisplayValue= false)]
        public string ImageFileName { get; set; }

        [HiddenInput(DisplayValue = false)]
        public string ImageMimeType { get; set; }
    }
}